package me.zhulu.drools.wac.loan;

import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * User: herosea
 * Date: 14-7-17
 * Time: 上午10:18
 * To change this template use File | Settings | File Templates.
 */
public class Result {

    private int uid;
    private String suite; // A、B or other

    private HashMap<String, ResultItem> veto = new HashMap(); //否决Map

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public String getSuite() {
        return suite;
    }

    public void setSuite(String suite) {
        this.suite = suite;
    }

    public ResultItem addVeto(String group, String rule, String message) {
        ResultItem item = new ResultItem(group, rule, message);
        return this.veto.put(getKey(item), item);
    }

    private String getKey(ResultItem item) {
        String key = item.getGroup() + "|" + item.getRule();
        return key;
    }

    public HashMap<String, ResultItem> getVeto() {
        return veto;
    }

    public void setVeto(HashMap<String, ResultItem> veto) {
        this.veto = veto;
    }

    public boolean isRefuse() {
        if(!veto.isEmpty()) {
            return true;
        }
        return false;
    }
}
